package com.longxiao.vo;

import com.longxiao.entity.Message;

import java.text.SimpleDateFormat;

/**
 * 站内信
 *
 * @author kunyang
 */
public class MessageVo {

    /** 消息标识 */
    private Integer id;

    /** 标题 */
    private String title;

    /** 内容 */
    private String content;

    private String createdTime;

    public MessageVo() {

    }

    public MessageVo(Integer id, String title, String content, String createdTime) {
        this.id = id;
        this.title = title;
        this.content = content;
        this.createdTime = createdTime;
    }

    public static MessageVo createTchObj(Message message) {
        MessageVo vo = new MessageVo(message.getId(), message.getTitle(), message.getContent(), message.getCreatedTime().toGMTString());
        return vo;
    }

    public static MessageVo createStuObj(Message message) {
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        MessageVo vo = new MessageVo(message.getId(), message.getTitle(), message.getContent(), sdf.format(message.getCreatedTime()));
        return vo;
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public String getTitle() {
        return title;
    }

    public void setTitle(String title) {
        this.title = title;
    }

    public String getContent() {
        return content;
    }

    public void setContent(String content) {
        this.content = content;
    }

    public String getCreatedTime() {
        return createdTime;
    }

    public void setCreatedTime(String createdTime) {
        this.createdTime = createdTime;
    }

    @Override
    public String toString() {
        return "MessageVo{" +
                "id='" + id + '\'' +
                ", title='" + title + '\'' +
                ", content='" + content + '\'' +
                ", createdTime='" + createdTime + '\'' +
                '}';
    }
}
